﻿@{
    var _FindBack = Tools.HttpHelper.Request.Query["findback"].ToStr();
}


<div class="page animation-fade" id="app">

    <div class="page-content">
        <!--高级检索部分-->
        <div class="panel" id="panelSearch">
            <div class="panel-heading">
                <h3 class="panel-title">高级检索</h3>
            </div>
            <div class="panel-body">
                <form action="javascript:void(0)" class="form-row">
                    <div class="col-sm-3">
                        <h4 class="example-title">用户名</h4>
                        <input type="text" class="form-control" name="User_Name" placeholder="请输入用户名">
                    </div>
                    <div class="col-sm-3">
                        <h4 class="example-title">登录名</h4>
                        <input type="text" class="form-control" name="User_LoginName" placeholder="请输入登录名">
                    </div>
                </form>

            </div>
            <div class="panel-footer text-right">
                <button class="btn btn-primary" onclick="adminList.search()">检索</button>&nbsp;&nbsp;
                <button class="btn btn-success" onclick="adminList.resetSearch()">重置</button>&nbsp;&nbsp;
                <button class="btn btn-danger" onclick="adminList.panelSearch()">关闭</button>
            </div>
        </div>

        <!--列表-->
        <div class="panel">
            <div class="panel-heading">
                <div class="col-sm-12 pt-3">
                    <ul id="adminTools">
                        <li>
                            <a href=""><i class="fa fa-rotate-right"></i>&nbsp;刷新</a>
                        </li>
                        <li data-power="Search" name="search">
                            <a href="javascript:;" onclick="adminList.panelSearch()"><i class="fa fa-search"></i>&nbsp;检索</a>
                        </li>
                        <li data-power="Add" name="add">
                            <a href="javascript:;" v-on:click="form('add')"><i class="fa fa-plus"></i>&nbsp;添加</a>
                        </li>
                        <li data-power="Edit" name="edit" style="display:none;">
                            <a href="javascript:;" v-on:click="form('edit')"><i class="fa fa-pencil"></i>&nbsp;修改</a>
                        </li>
                        <li data-power="Delete" name="delete" style="display:none;">
                            <a href="javascript:;" v-on:click="remove()"><i class="fa fa-trash"></i>&nbsp;删除</a>
                        </li>
                        <li data-power="GetExcel" name="getExcel">
                            <a href="javascript:;" target="_blank" v-on:click="exportExcel"><i class="fa fa-file-excel-o"></i>&nbsp;导出 Excel</a>
                        </li>
                        <li data-power="Print" name="print">
                            <a href="javascript:;" target="_blank" v-on:click="print"><i class="fa fa-file-text"></i>&nbsp;打印</a>
                        </li>
                        @if (_FindBack == "Multiple")
                        {
                            <!--查找带回按钮-->
                            <li data-power="GetExcel" name="getExcel">
                                <a href="javascript:;" onclick="adminList.findBack();"><i class="fa fa-file-excel-o"></i>&nbsp;带回</a>
                            </li>
                        }
                    </ul>
                </div>
            </div>
            <div class="panel-body container-fluid p-10">

                <!--表格-->
                <table class="table table-hover" id="bootStrapTable"></table>

            </div>
        </div>
    </div>
</div>

@section css{
    <style type="text/css">
    </style>
}
@section js{
    <script src="~/Admin/libs/bootstrap-table-develop/dist/bootstrap-table.min.js"></script>
    <script src="~/Admin/libs/bootstrap-table-develop/dist/locale/bootstrap-table-zh-CN.min.js"></script>
    <script src="~/Admin/js/admin-list.js"></script>
    <script type="text/javascript">
        var vueApp = new Vue({
            el: "#app",
            data: {
                formId: '@ViewData["formWindowName"]',
                thisWindowName: '@ViewData["thisWindowName"]',
                power: JSON.parse('@Html.Raw(ViewData["PowerModel"])')
            },
            mounted: function () {//页面加载完成
                this.load();
                console.log(this.power);
            },
            //函数集合
            methods: {
                //加载
                load: function () {
                    admin.ajax({
                        url: "@Url.Action("GetDataSource")",
                        data: { rows: 1 },
                        success: function (r) {
                            let adminBootStrapTable = adminList.bootStrapTable({
                                url: "@Url.Action("GetDataSource")",
                                columns: r.column
                            });
                        }
                    });
                },
                //打开表单
                form: function (tag) {
                    let rows = adminList.selectRows();
                    let url = "@Url.Action("Info")";
                    if (tag == "add") {
                        url = url + "/?ID=";
                    } else {
                        url = url + "/?ID=" + rows[0]._ukid;
                    }
                    adminList.form({
                        id: vueApp.formId,
                        parentIframeName: vueApp.thisWindowName,
                        url: url,
                        width: "600px",
                        height: "1500px",
                        btn: false,
                    });
                },
                //删除数据
                remove: function () {
                    adminList.delete('@Url.Action("Delete")', function () {
                        vueApp.refresh();
                        console.log("删除完成!");
                    });
                },
                //刷新列表数据
                refresh: function (data) {
                    adminList.refresh(data);
                },
                //导出excel
                exportExcel: function () {
                    adminList.exportExcel('@Url.Action("ExportExcel")');
                },
                //打印
                print: function () {
                    adminList.print('@Url.Action("Print")');
                },

            }
        });

    </script>
}
